package com.littcore.saap.assistant.dao;

import com.littcore.dao.GenericHibernateDao;
import com.littcore.saap.assistant.po.UserFavourite;
import com.littcore.saap.core.web.util.LoginUtils;


/**
 * .
 * 
 * <pre><b>描述：</b>
 *    
 * </pre>
 * 
 * <pre><b>修改记录：</b>
 *    
 * </pre>
 * 
 * @author <a href="mailto:littcai@hotmail.com">蔡源</a>
 * @since 2015年6月24日
 * @version 1.0
 */
public class UserFavouriteDao extends GenericHibernateDao<UserFavourite, Integer> {
	
	public UserFavourite findUnique(String moduleCode,int recordId,int createBy,int tenantId){
		String hql="from UserFavourite where moduleCode=? and recordId=? and createBy=? and tenantId=?";
		return (UserFavourite)super.uniqueResult(hql,new Object[]{moduleCode,recordId,createBy,tenantId});
	}
	
	public void delete(int id){
		int tenantId=LoginUtils.getTenantId();
		String hql="delete from UserFavourite where tenantId=? and id=?";
		super.execute(hql,new Object[]{tenantId,id});
	}

}
